#include "Axes.h"

GLfloat oneArrayForColors[4] = {0.0f};
GLfloat twoArrayForColors[4] = {0.0f};
GLfloat threeArrayForColors[4] = {0.0f};

Axes::Axes(GLShaderManager* shaderManager, GLGeometryTransform& transformPipeline, GLBatch axesBatch)
:ThreeDObject(shaderManager, transformPipeline) {
	this->axes = axesBatch;

	fillInRed();

	fillInGreen();

	fillInYellow();
}
void Axes::apearOnScreen() {
	axes.Reset();
	addXAxis();
	this->shaderManager->UseStockShader(GLT_SHADER_FLAT,
		this->transformPipeline.GetModelViewProjectionMatrix(),
		this->xAxisColor);
	this->axes.Draw();

	axes.Reset();
	addYAxis();
	this->shaderManager->UseStockShader(GLT_SHADER_FLAT,
		this->transformPipeline.GetModelViewProjectionMatrix(),
		this->yAxisColor);
	this->axes.Draw();

	axes.Reset();
	addZAxis();
	this->shaderManager->UseStockShader(GLT_SHADER_FLAT,
		this->transformPipeline.GetModelViewProjectionMatrix(),
		this->zAxisColor);
	this->axes.Draw();
}
void Axes::addXAxis() {
	axes.Begin(GL_LINES, 2);
	// the x axis
	axes.Vertex3f(-20.0f, 0.0f, 0.0f);
	axes.Vertex3f(20.0f, 0.0f, 0.0f);
	axes.End();
}
void Axes::addYAxis() {
	axes.Begin(GL_LINES, 2);
	// the y axis
	axes.Vertex3f(0.0f, -20.0f, 0.0f);
	axes.Vertex3f(0.0f, 20.0f, 0.0f);
	axes.End();
}
void Axes::addZAxis() {
	axes.Begin(GL_LINES, 2);
	// the z axis
	axes.Vertex3f(0.0f, 0.0f, 20.0f);
	axes.Vertex3f(0.0f, 0.0f, -20.0f);
	axes.End();
}
void Axes::fillInRed() {
	xAxisColor[0] = 1.0f;
	xAxisColor[1] = 0.0f;
	xAxisColor[2] = 0.0f;
	xAxisColor[3] = 1.0f;
}
void Axes::fillInGreen() {
	yAxisColor[0] = 0.0f;
	yAxisColor[1] = 1.0f;
	yAxisColor[2] = 0.0f;
	yAxisColor[3] = 1.0f;
}
void Axes::fillInYellow() {
	zAxisColor[0] = 1.0f;
	zAxisColor[1] = 1.0f;
	zAxisColor[2] = 0.0f;
	zAxisColor[3] = 1.0f;
}
